#
# @lc app=leetcode.cn id=507 lang=python
#
# [507] 完美数
#

# @lc code=start
class Solution(object):
    def checkPerfectNumber(self, num):
        """
        :type num: int
        :rtype: bool
        """
        factors = []
        for i in range(1, int(math.sqrt(num)+1)):
            if num % i == 0 and i!= num:
                factors.append(i)
                if i!= 1:
                    factors.append(num // i)
        print(factors)
        return sum(factors) == num
# @lc code=end

